﻿using System.CodeDom;

namespace MaoCaiJun.DataBase.BuildProviders.Function
{
    class Download
    {
        public static MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property ID
        {
            get
            {
                return new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "下载id", Name = "Id", SqlName = "Id", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = true, SqlLength = "255", SqlIndex = "PK_" + System.Guid.NewGuid().ToString("N") };
            }
        }

        public static MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property[] Property
        {
            get
            {
                System.Collections.Generic.List<MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property> _property = new System.Collections.Generic.List<MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property>();
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "频道ID", Name = "ChannelID", SqlName = "ChannelID", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "栏目ID", Name = "CatalogID", SqlName = "CatalogID", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "专题ID", Name = "SpecialID", SqlName = "SpecialID", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件名称", Name = "Title", SqlName = "Title", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "标题颜色", Name = "TitleFontColor", SqlName = "TitleFontColor", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "标题字型", Name = "TitleFontType", SqlName = "TitleFontType", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "完整标题", Name = "TitleIntact", SqlName = "TitleIntact", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "副标题", Name = "Subheading", SqlName = "Subheading", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件图片", Name = "SoftImg", SqlName = "SoftImg", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件版本", Name = "SoftEdition", SqlName = "SoftEdition", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "运行环境(如: .Net 2.0 ,WinXP,Win2000,WinNT)", Name = "SoftRun", SqlName = "SoftRun", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "作者", Name = "Author", SqlName = "Author", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "来源", Name = "CopyFrom", SqlName = "CopyFrom", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "录入者", Name = "Inputer", SqlName = "Inputer", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件性质(如: 简体中文/免费软件 )", Name = "SoftCharacter", SqlName = "SoftCharacter", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "关键字", Name = "Keyword", SqlName = "Keyword", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "点击数", Name = "Hits", SqlName = "Hits", Value = "", SqlValue = "", Type = "System.Int32", SqlType = "int", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "是否热门", Name = "Hot", SqlName = "Hot", Value = "", SqlValue = "", Type = "System.Boolean", SqlType = "bit", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "是否固顶", Name = "OnTop", SqlName = "OnTop", Value = "", SqlValue = "", Type = "System.Boolean", SqlType = "bit", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "是否推荐", Name = "Elite", SqlName = "Elite", Value = "", SqlValue = "", Type = "System.Boolean", SqlType = "bit", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "是否审核", Name = "Passed", SqlName = "Passed", Value = "", SqlValue = "", Type = "System.Boolean", SqlType = "bit", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "时间", Name = "Dat", SqlName = "Dat", Value = "1980-1-1", SqlValue = "1980-1-1", Type = "System.DateTime", SqlType = "datetime", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "更新时间", Name = "UpdateTime", SqlName = "UpdateTime", Value = "1980-1-1", SqlValue = "1980-1-1", Type = "System.DateTime", SqlType = "datetime", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "插入时间", Name = "InsertTime", SqlName = "InsertTime", Value = "1980-1-1", SqlValue = "1980-1-1", Type = "System.DateTime", SqlType = "datetime", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件大小(kb)", Name = "Size", SqlName = "Size", Value = "", SqlValue = "", Type = "System.Int32", SqlType = "int", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件语言", Name = "Language", SqlName = "Language", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "简介", Name = "Intro", SqlName = "Intro", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "更新记录", Name = "Log", SqlName = "Log", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "下载", Name = "FileDownload", SqlName = "FileDownload", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "下载地址组", Name = "Downloads", SqlName = "Downloads", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件md5", Name = "Md5", SqlName = "Md5", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "评分等级", Name = "Stars", SqlName = "Stars", Value = "", SqlValue = "", Type = "System.Int32", SqlType = "int", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "点击数", Name = "ReadPoint", SqlName = "ReadPoint", Value = "", SqlValue = "", Type = "System.Int32", SqlType = "int", SqlNotNull = false, SqlLength = "255", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件说明", Name = "Content", SqlName = "Content", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "转向链接", Name = "LinkUrl", SqlName = "LinkUrl", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件授权(如: 共享软件)", Name = "Authorization", SqlName = "Authorization", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "官方网站", Name = "Http", SqlName = "Http", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件类别", Name = "Suffix", SqlName = "Suffix", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });
                _property.Add(new MaoCaiJun.DataBase.Configuration.DbsAnalysis.Property { Summary = "软件分类", Name = "Catalog", SqlName = "Catalog", Value = "", SqlValue = "", Type = "System.String", SqlType = "nvarchar", SqlNotNull = false, SqlLength = "MAX", SqlIndex = "", Attribute = MemberAttributes.Public });

                return _property.ToArray();

                ////////////////////////////////////////////////////////////
                /*
    软件名称
    软件图片
    软件版本： 2.16 
    最后更新： 2008-5-1 
    软件大小： 2.3 MB 
    软件性质： 简体中文/免费软件 
    运行环境： .Net 2.0 ,WinXP,Win2000,WinNT
    下载次数： 134877  
    软件授权:共享软件
    官方网站:http://www.klplayer.com/
    软件评级
    软件分类
    软件类别:exe,doc
    软件语言
    联 系 人
    软件md5
    软件信息:
    软件介绍:
    下载地址组
    更新记录 
     */


                /*
    -软件名称
    -软件图片
    -软件版本： 2.16 
    -最后更新： 2008-5-1 
    -下载次数： 134877  
    -软件评级
    -联 系 人
    -软件介绍:
    软件大小： 2.3 MB 
    软件性质： 简体中文/免费软件 
    运行环境： .Net 2.0 ,WinXP,Win2000,WinNT
    软件授权:共享软件
    官方网站:http://www.klplayer.com/
    软件分类
    软件类别:exe,doc
    软件语言
    软件md5
    下载地址组
    更新记录

                 */
            }
        }


        public Download(MaoCaiJun.DataBase.Configuration.DbsAnalysis.Class dbsAnalysisClass)
        {
            dbsAnalysisClass.ID = Function.Download.ID;
            dbsAnalysisClass.Property.AddRange(Function.Download.Property);

            ////////////////////////////////////////////////////////////
//            #region  Download
//            #region 生成类
//            CodeTypeDeclaration ctd1 = new CodeTypeDeclaration(dbsAnalysisClass.Name);//生成类
//            ctd1.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" Copyright (C) " + System.DateTime.Today.Year + "  毛才君 版权所有。", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 文件编号：      ", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 文 件 名：      ", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 文件功能描述：  文件下载 " + dbsAnalysisClass.Name + "的逻辑体", false));
//            ctd1.Comments.Add(new CodeCommentStatement("", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 创建标识：      毛才君    " + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "", false));
//            ctd1.Comments.Add(new CodeCommentStatement("", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
//            ctd1.Comments.Add(new CodeCommentStatement("", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
//            ctd1.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
//            ctd1.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));

//            ctd1.IsClass = true;
//            ctd1.IsPartial = true;
//            ctd1.Attributes = MemberAttributes.Public;
//            //生成类注释
//            ctd1.Comments.Add(new CodeCommentStatement("<summary>", true));
//            ctd1.Comments.Add(new CodeCommentStatement("文件下载 " + dbsAnalysisClass.Name + "的逻辑体", true));
//            ctd1.Comments.Add(new CodeCommentStatement("</summary>", true));
//             #endregion

//            #region 生成类字段
   
////                //生成类的 私有字段
////            CodeMemberField FieldShowLine_ = new CodeMemberField();
////            FieldShowLine_.Attributes = MemberAttributes.Private | MemberAttributes.Static;
////            FieldShowLine_.Type = new CodeTypeReference("System.Boolean",1);
////            FieldShowLine_.Name = "ShowLine_= { false, false, false, false, false, false, false, false, false, false }";
////            ctd1.Members.Add(FieldShowLine_);

////            CodeMemberField FieldShowLine = new CodeMemberField();
////            FieldShowLine.Attributes = MemberAttributes.Private | MemberAttributes.Static;
////            FieldShowLine.Type = new CodeTypeReference(typeof(System.Collections.ArrayList));
////            FieldShowLine.Name = "ShowLine = new System.Collections.ArrayList(ShowLine_)";
////            ctd1.Members.Add(FieldShowLine);

////            CodeMemberField Fieldtable = new CodeMemberField();
////            Fieldtable.Attributes = MemberAttributes.Private | MemberAttributes.Static;
////            Fieldtable.Type = new CodeTypeReference(typeof(string));
////            Fieldtable.Name = "table = " + dbsAnalysisClass .Name+ ".TableName";
////            ctd1.Members.Add(Fieldtable);

////            CodeMemberField Fieldnbsp = new CodeMemberField();
////            Fieldnbsp.Attributes = MemberAttributes.Private | MemberAttributes.Static;
////            Fieldnbsp.Type = new CodeTypeReference(typeof(string));
////            Fieldnbsp.Name = "nbsp = new string(new char[] { (char)0xA0 })";
////            ctd1.Members.Add(Fieldnbsp);
//            #endregion

//            #region 方法
////            //filtrate
////            CodeMemberMethod MethodFiltrate = new CodeMemberMethod();
////            MethodFiltrate.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodFiltrate.Comments.Add(new CodeCommentStatement("过滤特殊字符", true));
////            MethodFiltrate.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodFiltrate.Comments.Add(new CodeCommentStatement("<param name=\"sqlstr\">要过滤特殊字符的字符串</param>", true));
////            MethodFiltrate.Comments.Add(new CodeCommentStatement("<returns>过滤好的字符串</returns>", true));
////            MethodFiltrate.Name = "filtrate";
////            MethodFiltrate.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodFiltrate.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "sqlstr"));
////            MethodFiltrate.ReturnType = new CodeTypeReference(typeof(string));
////            MethodFiltrate.Statements.Add(new CodeSnippetExpression("sqlstr = sqlstr.Replace(\"'\", \"''\")"));
////            MethodFiltrate.Statements.Add(new CodeSnippetExpression("sqlstr = sqlstr.Replace(\"--\", \"\")"));
////            MethodFiltrate.Statements.Add(new CodeSnippetExpression("sqlstr = sqlstr.Replace(\":\", \"\")"));
////            MethodFiltrate.Statements.Add(new CodeSnippetExpression("return sqlstr"));
////            ctd1.Members.Add(MethodFiltrate);
////            //SelectCatalog
////            CodeMemberMethod MethodSelectCatalog = new CodeMemberMethod();
////            MethodSelectCatalog.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodSelectCatalog.Comments.Add(new CodeCommentStatement("得到一个对象实体", true));
////            MethodSelectCatalog.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodSelectCatalog.Comments.Add(new CodeCommentStatement("<param name=\"className\">栏目名称</param>", true));
////            MethodSelectCatalog.Comments.Add(new CodeCommentStatement("<returns> </returns>", true));
////            MethodSelectCatalog.Name = "Select"+dbsAnalysisClass.Name;
////            MethodSelectCatalog.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodSelectCatalog.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "className"));
////            MethodSelectCatalog.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name);
////           string str_temp = @"
////            System.Collections.Generic.List<{0}> lc = Select{0}(0, 1, ""className = '"" + className + ""'"", ""OrderID"");
////            return lc.Count > 0 ? lc[0] : null;
////
////";
////            MethodSelectCatalog.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodSelectCatalog);
////            #region 添加栏目
////            //addClass1
////            CodeMemberMethod MethodAddClass1 = new CodeMemberMethod();
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("添加栏目", true));
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("<param name=\"classname\">栏目名称</param>", true));
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("<param name=\"description\">栏目详情</param>", true));
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("<param name=\"parentid\">父栏目ID</param>", true));
////            MethodAddClass1.Comments.Add(new CodeCommentStatement("<returns>-1:表示有重复的项目 -2:表示所属类别不存在</returns>", true));
////            MethodAddClass1.Name = "addClass";
////            MethodAddClass1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodAddClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "classname"));
////            MethodAddClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "description"));
////            MethodAddClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "parentid"));
////            MethodAddClass1.ReturnType = new CodeTypeReference(typeof(Int32));
////            MethodAddClass1.Statements.Add(new CodeSnippetExpression(dbsAnalysisClass.Name + " temp=new " + dbsAnalysisClass.Name + "()"));
////            MethodAddClass1.Statements.Add(new CodeSnippetExpression("temp.ClassName=classname"));
////            MethodAddClass1.Statements.Add(new CodeSnippetExpression("temp.ParentID=parentid"));
////            MethodAddClass1.Statements.Add(new CodeSnippetExpression("temp.Description=description"));
////            MethodAddClass1.Statements.Add(new CodeSnippetExpression("return addClass(temp)"));
////            ctd1.Members.Add(MethodAddClass1);
////            //addClass2
            
////            CodeMemberMethod MethodAddClass2 = new CodeMemberMethod();
////            MethodAddClass2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodAddClass2.Comments.Add(new CodeCommentStatement("添加栏目", true));
////            MethodAddClass2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodAddClass2.Comments.Add(new CodeCommentStatement("<param name=\"catalog\">栏目对像</param>", true));
////            MethodAddClass2.Comments.Add(new CodeCommentStatement("<returns>-1:表示有重复的项目 -2:表示所属类别不存在</returns>", true));
////            MethodAddClass2.Name = "addClass";
////            MethodAddClass2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodAddClass2.Parameters.Add(new CodeParameterDeclarationExpression(dbsAnalysisClass.Name, "catalog"));
////            MethodAddClass2.ReturnType = new CodeTypeReference(typeof(Int32));
            
////             str_temp=@"
////            int rtn = 0;
////            int Child = 0;//父系栏目的子栏目数目
////            int MaxClassID, id;
////            int MaxOrderID, rootid;
////            int previd;
////            int orderid;
////            string parentpath = ""0"";
////            int depth = 0;
////            object c, o, temp_;
////            c = {0}.HelperDB.GetSingle(""select Max(id) From "" + table);
////            o = {0}.HelperDB.GetSingle(""select Max(orderid) From "" + table);
////            if (c != null && c.ToString() != string.Empty)
////                MaxClassID = Convert.ToInt32(c);
////            else
////                MaxClassID = 0;
////            if (o != null && o.ToString() != """")
////                MaxOrderID = Convert.ToInt32(o);
////            else
////                MaxOrderID = 0;
////            o = null;
////            c = null;
////
////            id = MaxClassID + 1;
////            rootid = id;
////            previd = MaxClassID;
////            orderid = MaxOrderID + 1;
////
////            if (catalog.ParentID > 0)
////            {{
////                //检查是不是有重复的项目
////                string sql = ""Select id From "" + table + "" Where parentid="" + catalog.ParentID + "" AND ClassName='"" + catalog.ClassName + ""'"";
////                //return sql;
////                if ({0}.HelperDB.GetSingle(sql) != null)
////                {{
////                    rtn = -1;//表示有重复的项目
////                    return rtn;
////                }}
////
////                //检查所属类别是否存在
////                sql = ""select rootid From "" + table + "" where id="" + catalog.ParentID;
////                if ({0}.HelperDB.GetSingle(sql) == null)
////                {{
////                    rtn = -2;//表示所属类别不存在
////                    return rtn;
////                }}
////                else
////                {{
////                  
////                }}
////
////                sql = ""select * From "" + table + "" where id="" + catalog.ParentID;
////                System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////                if (dr.Read())
////                {{
////                    //重新定义parentpath
////                    parentpath = (string)dr[""parentpath""] + "","" + catalog.ParentID;
////                    //重新定义depth
////                    depth = Convert.ToInt32(dr[""depth""]) + 1;
////                    //重新定义rootid
////                    rootid = Convert.ToInt32(dr[""rootid""]);
////                    //重新定义Child
////                    Child = Convert.ToInt32(dr[""Child""]);
////                    //重新定义orderid
////                    orderid = Convert.ToInt32(dr[""orderid""]);
////
////                }}
////                dr.Close();
////                dr.Dispose();
////
////                //重新定义orderid
////                //sql=""select Max(OrderID) From ""+ table +"" where rootid="" + rootid;//要注意是刚得到值的rootid
////                //temp={0}.HelperDB.GetSingle(sql);
////                //if(temp!=null && temp.ToString()!="""")
////                //orderid=Convert.ToInt32(temp) + 1;
////                //else
////                //orderid=1;
////
////                if (Child > 0)
////                {{
////                    //得到属于此父系栏目的所有的栏目的最大的OrderID
////                    sql = ""select Max(OrderID) From "" + table + "" where ParentPath + ',' like '"" + parentpath + "",%'"";
////                    orderid = Convert.ToInt32({0}.HelperDB.GetSingle(sql)) + 1;
////                }}
////                else//第一次添加子栏目
////                {{
////                    orderid = orderid + 1;//父系栏目的orderid+1
////                }}
////
////                //父栏目的child+1
////                sql = ""update "" + table + "" set child=child+1 where  id="" + catalog.ParentID;
////                {0}.HelperDB.ExecuteSql(sql);
////
////            }}
////
////            //重新定义同一级栏目上一级的nextid
////            string sql_ = ""update "" + table + "" set nextid="" + id + "" where id=(select top 1 id from "" + table + "" where parentid="" + catalog.ParentID + ""  order by orderid desc,id desc)"";
////            {0}.HelperDB.ExecuteSql(sql_);
////
////            //重新定义previd
////            sql_ = ""select id From "" + table + "" where ParentID="" + catalog.ParentID + "" order by orderid desc"";
////            temp_ = {0}.HelperDB.GetSingle(sql_);
////            if (temp_ != null)
////                previd = Convert.ToInt32(temp_);
////            else
////                previd = 0;
////
////            //重新修改其他栏目的orderid
////            sql_ = ""update "" + table + "" set orderid=orderid+1 where orderid>="" + orderid;
////            {0}.HelperDB.ExecuteSql(sql_);
////
////            //执行插入语句
////            catalog.Id = id;
////            catalog.ParentPath = parentpath;
////            catalog.Depth = depth;
////            catalog.RootID = rootid;
////            catalog.PrevID = previd;
////            catalog.OrderID = orderid;
////            catalog.Save();
////            //sql_ = ""insert into "" + table + "" (id,classname,description,parentid,parentpath,depth,rootid,child,previd,nextid,orderid)"";
////            //sql_ += ""values ("" + id + "",'"" + classname + ""','"" + description + ""',"" + parentid + "",'"" + parentpath + ""',"" + depth + "","" + rootid + "",0,"" + previd + "",0,"" + orderid + "")"";
////            //{0}.HelperDB.ExecuteSql(sql_);
////            return id;
////";
////            MethodAddClass2.Statements.Add(new CodeSnippetStatement(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodAddClass2);
////            #endregion 添加栏目
////            #region 修改栏目
////            //modiClass1
////            CodeMemberMethod MethodModiClass1 = new CodeMemberMethod();
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("修改栏目", true));
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("<param name=\"id\">要修改栏目ID</param>", true));
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("<param name=\"classname\">栏目名称</param>", true));
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("<param name=\"description\">栏目详情</param>", true));
////            MethodModiClass1.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:栏目不存在 2:同一级栏目已经有重复的</returns>", true));
////            MethodModiClass1.Name = "modiClass";
////            MethodModiClass1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodModiClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodModiClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "classname"));
////            MethodModiClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "description"));
////            MethodModiClass1.ReturnType = new CodeTypeReference(typeof(Int32));
////            MethodModiClass1.Statements.Add(new CodeSnippetExpression(dbsAnalysisClass.Name + " temp=new " + dbsAnalysisClass.Name + "()"));
////            MethodModiClass1.Statements.Add(new CodeSnippetExpression("temp.Id=id"));
////            MethodModiClass1.Statements.Add(new CodeSnippetExpression("temp.ClassName=classname"));
////            MethodModiClass1.Statements.Add(new CodeSnippetExpression("temp.Description=description"));
////            MethodModiClass1.Statements.Add(new CodeSnippetExpression("return modiClass(temp)"));
////            ctd1.Members.Add(MethodModiClass1);
////            //modiClass2
////            CodeMemberMethod MethodModiClass2 = new CodeMemberMethod();
////            MethodModiClass2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodModiClass2.Comments.Add(new CodeCommentStatement("修改栏目", true));
////            MethodModiClass2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodModiClass2.Comments.Add(new CodeCommentStatement("<param name=\"catalog\">要修改的栏目对像</param>", true));
////            MethodModiClass2.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:栏目不存在 2:同一级栏目已经有重复的</returns>", true));
////            MethodModiClass2.Name = "modiClass";
////            MethodModiClass2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodModiClass2.Parameters.Add(new CodeParameterDeclarationExpression(dbsAnalysisClass.Name, "catalog"));
////            MethodModiClass2.ReturnType = new CodeTypeReference(typeof(Int32));

////            str_temp = @"
////            {0} temp = new {0}();
////            if (!temp.Read(catalog.Id))
////            {{
////                return 1;//栏目不存在
////            }}
////            catalog.Child = temp.Child;
////            catalog.Depth = temp.Depth;
////            catalog.Id = temp.Id;
////            catalog.NextID = temp.NextID;
////            catalog.OrderID = temp.OrderID;
////            catalog.ParentID = temp.ParentID;
////            catalog.ParentPath = temp.ParentPath;
////            catalog.PrevID = temp.PrevID;
////            catalog.RootID = temp.RootID;
////            if ({0}.Select{0}Count(""classname='"" + catalog.ClassName + ""' and parentid="" + catalog.ParentID + "" and id<>"" + catalog.Id) != 0)
////            {{
////                return 2;//同一级栏目已经有重复的
////            }}
////
////            catalog.Update();
////            return 0;
////";
////            MethodModiClass2.Statements.Add(new CodeSnippetStatement(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodModiClass2);
////            #endregion 修改栏目
////            #region 删除栏目
////            //deleteTree1
////            CodeMemberMethod MethodDeleteTree1 = new CodeMemberMethod();
////            MethodDeleteTree1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDeleteTree1.Comments.Add(new CodeCommentStatement("删除栏目树", true));
////            MethodDeleteTree1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDeleteTree1.Comments.Add(new CodeCommentStatement("<param name=\"id\">要删除栏目ID</param>", true));
////            MethodDeleteTree1.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:栏目不存在 </returns>", true));
////            MethodDeleteTree1.Name = "deleteTree";
////            MethodDeleteTree1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodDeleteTree1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodDeleteTree1.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            string parentpath = """";
////            int orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            sql = ""select * from "" + table + "" where id="" + id;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                parentpath = dr[""parentpath""].ToString();
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (depth > 0)
////                //更新父系栏目的子栏目数目
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set child=child-1 where id="" + parentid);
////
////            //修改上一类别的NextID和下一类别的PrevID
////            if (previd > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set NextID="" + nextid + "" where id="" + previd);
////            if (nextid > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set PrevID="" + previd + "" where id="" + nextid);
////            //删除这个栏目
////            sql = ""delete from "" + table + "" where id="" + id;
////            {0}.HelperDB.ExecuteSql(sql);
////            if (child > 0)
////            {{
////                string children = getChildren(id);
////                //得到最大的orderid,以便后面更新orderid
////                sql = ""select max(orderid) from "" + table + "" where id in ("" + children + "")"";
////                orderid = Convert.ToInt32({0}.HelperDB.GetSingle(sql));
////                //删除子栏目
////                sql = ""delete from "" + table + "" where id in ("" + children + "")"";
////                {0}.HelperDB.ExecuteSql(sql);
////            }}
////
////            //重新更新orderid
////            sql = ""update "" + table + "" set orderid=orderid-"" + (child + 1) + "" where orderid>"" + orderid;
////            {0}.HelperDB.ExecuteSql(sql);
////            return 0;
////";
////            MethodDeleteTree1.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDeleteTree1);
////            //deleteTree2
////            CodeMemberMethod MethodDeleteTree2 = new CodeMemberMethod();
////            MethodDeleteTree2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDeleteTree2.Comments.Add(new CodeCommentStatement("删除栏目树", true));
////            MethodDeleteTree2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDeleteTree2.Comments.Add(new CodeCommentStatement("<param name=\"className\">要删除栏目的名称</param>", true));
////            MethodDeleteTree2.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:栏目不存在 </returns>", true));
////            MethodDeleteTree2.Name = "deleteTree";
////            MethodDeleteTree2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodDeleteTree2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "className"));
////            MethodDeleteTree2.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            string parentpath = """";
////            int id, orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            sql = ""select * from "" + table + "" where ClassName = '"" + className + ""'"";
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                id = Convert.ToInt32(dr[""id""]);
////                parentpath = dr[""parentpath""].ToString();
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (depth > 0)
////                //更新父系栏目的子栏目数目
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set child=child-1 where id="" + parentid);
////
////            //修改上一类别的NextID和下一类别的PrevID
////            if (previd > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set NextID="" + nextid + "" where id="" + previd);
////            if (nextid > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set PrevID="" + previd + "" where id="" + nextid);
////            //删除这个栏目
////            sql = ""delete from "" + table + "" where id="" + id;
////            {0}.HelperDB.ExecuteSql(sql);
////            if (child > 0)
////            {{
////                string children = getChildren(id);
////                //得到最大的orderid,以便后面更新orderid
////                sql = ""select max(orderid) from "" + table + "" where id in ("" + children + "")"";
////                orderid = Convert.ToInt32({0}.HelperDB.GetSingle(sql));
////                //删除子栏目
////                sql = ""delete from "" + table + "" where id in ("" + children + "")"";
////                {0}.HelperDB.ExecuteSql(sql);
////            }}
////
////            //重新更新orderid
////            sql = ""update "" + table + "" set orderid=orderid-"" + (child + 1) + "" where orderid>"" + orderid;
////            {0}.HelperDB.ExecuteSql(sql);
////            return 0;
////";
////            MethodDeleteTree2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDeleteTree2);
////            //deleteAllCatalog
////            CodeMemberMethod MethodDeleteAllCatalog = new CodeMemberMethod();
////            MethodDeleteAllCatalog.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDeleteAllCatalog.Comments.Add(new CodeCommentStatement("删除全部栏目", true));
////            MethodDeleteAllCatalog.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDeleteAllCatalog.Name = "deleteAllCatalog";
////            MethodDeleteAllCatalog.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            str_temp = @"
////            string sql = ""delete from "" + table;
////            {0}.HelperDB.ExecuteSql(sql);
////";
////            MethodDeleteAllCatalog.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDeleteAllCatalog);
////            //deleteClass1
////            CodeMemberMethod MethodDeleteClass1 = new CodeMemberMethod();
////            MethodDeleteClass1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDeleteClass1.Comments.Add(new CodeCommentStatement("删除栏目", true));
////            MethodDeleteClass1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDeleteClass1.Comments.Add(new CodeCommentStatement("<param name=\"id\">要删除栏目的id</param>", true));
////            MethodDeleteClass1.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:栏目不存在 2:该类别含有子类别</returns>", true));
////            MethodDeleteClass1.Name = "deleteClass";
////            MethodDeleteClass1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodDeleteClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodDeleteClass1.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            int Child, PrevID, NextID, Depth, ParentID, orderid;
////            sql = ""select id,RootID,Depth,ParentID,Child,PrevID,NextID,orderid From "" + table + "" where id="" + id;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                Child = Convert.ToInt32(dr[""child""]);
////                PrevID = Convert.ToInt32(dr[""previd""]);
////                NextID = Convert.ToInt32(dr[""nextid""]);
////                Depth = Convert.ToInt32(dr[""depth""]);
////                ParentID = Convert.ToInt32(dr[""parentid""]);
////                orderid = Convert.ToInt32(dr[""orderid""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//该栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (Child > 0)
////                return 2;//该类别含有子类别
////
////            if (Depth > 0)
////                //更新父系栏目的子栏目数目
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set child=child-1 where id="" + ParentID);
////
////            //修改上一类别的NextID和下一类别的PrevID
////            if (PrevID > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set NextID="" + NextID + "" where id="" + PrevID);
////            if (NextID > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set PrevID="" + PrevID + "" where id="" + NextID);
////
////            //删除栏目
////            {0}.HelperDB.ExecuteSql(""delete from "" + table + "" where id="" + id);
////            //这个栏目后面的排序orderid全部减1
////            {0}.HelperDB.ExecuteSql(""update "" + table + "" set orderid=orderid-1 where orderid>"" + orderid);
////
////            return 0;//执行成功
////";
////            MethodDeleteClass1.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDeleteClass1);
////            //deleteClass2
////            CodeMemberMethod MethodDeleteClass2 = new CodeMemberMethod();
////            MethodDeleteClass2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDeleteClass2.Comments.Add(new CodeCommentStatement("删除栏目", true));
////            MethodDeleteClass2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDeleteClass2.Comments.Add(new CodeCommentStatement("<param name=\"className\">要删除栏目的名称</param>", true));
////            MethodDeleteClass2.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:栏目不存在 2:该类别含有子类别</returns>", true));
////            MethodDeleteClass2.Name = "deleteClass";
////            MethodDeleteClass2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodDeleteClass2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "className"));
////            MethodDeleteClass2.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            int id, Child, PrevID, NextID, Depth, ParentID, orderid;
////            sql = ""select id,RootID,Depth,ParentID,Child,PrevID,NextID,orderid From "" + table + "" where className='"" + className + ""'"";
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                id = Convert.ToInt32(dr[""id""]);
////                Child = Convert.ToInt32(dr[""child""]);
////                PrevID = Convert.ToInt32(dr[""previd""]);
////                NextID = Convert.ToInt32(dr[""nextid""]);
////                Depth = Convert.ToInt32(dr[""depth""]);
////                ParentID = Convert.ToInt32(dr[""parentid""]);
////                orderid = Convert.ToInt32(dr[""orderid""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//该栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (Child > 0)
////                return 2;//该类别含有子类别
////
////            if (Depth > 0)
////                //更新父系栏目的子栏目数目
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set child=child-1 where id="" + ParentID);
////
////            //修改上一类别的NextID和下一类别的PrevID
////            if (PrevID > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set NextID="" + NextID + "" where id="" + PrevID);
////            if (NextID > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set PrevID="" + PrevID + "" where id="" + NextID);
////
////            //删除栏目
////            {0}.HelperDB.ExecuteSql(""delete from "" + table + "" where id="" + id);
////            //这个栏目后面的排序orderid全部减1
////            {0}.HelperDB.ExecuteSql(""update "" + table + "" set orderid=orderid-1 where orderid>"" + orderid);
////
////            return 0;//执行成功
////";
////            MethodDeleteClass2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDeleteClass2);
////            #endregion 删除栏目
////            #region 移动栏目
////            //upClass1
////            CodeMemberMethod MethodUpClass1 = new CodeMemberMethod();
////            MethodUpClass1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodUpClass1.Comments.Add(new CodeCommentStatement("向上移动栏目", true));
////            MethodUpClass1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodUpClass1.Comments.Add(new CodeCommentStatement("<param name=\"id\">要向上移动的栏目的id</param>", true));
////            MethodUpClass1.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:要提升排序的栏目不存在 2:要提升排序的栏目上面没有栏目,无法被提升 3:要提升排序的栏目的这一级别只有它一个，没办法被提升 4:要提升排序的栏目的上面的栏目不存在,被非法删除 </returns>", true));
////            MethodUpClass1.Name = "upClass";
////            MethodUpClass1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodUpClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodUpClass1.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            //先得到要提升的id的栏目信息
////            sql = ""select * from "" + table + "" where id="" + id;
////            int orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//要提升排序的栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (previd == 0)
////                return 2;//要提升排序的栏目上面没有栏目,无法被提升
////            if (nextid == 0 && previd == 0)
////                return 3;//要提升排序的栏目的这一级别只有它一个，没办法被提升
////
////            //得到上面一个栏目的信息
////            sql = ""select * from "" + table + "" where id="" + previd;
////            int orderid_ = 0, rootid_ = 0, previd_ = 0, nextid_ = 0, depth_ = 0, parentid_ = 0, child_ = 0;
////            dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                orderid_ = Convert.ToInt32(dr[""orderid""]);
////                rootid_ = Convert.ToInt32(dr[""rootid""]);
////                previd_ = Convert.ToInt32(dr[""previd""]);
////                nextid_ = Convert.ToInt32(dr[""nextid""]);
////                depth_ = Convert.ToInt32(dr[""depth""]);
////                parentid_ = Convert.ToInt32(dr[""parentid""]);
////                child_ = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 4;//要提升排序的栏目的上面的栏目不存在,被非法删除
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            //把原来previd=id的换为previd=previd
////            sql = ""update "" + table + "" set previd="" + previd + "" where previd="" + id;
////            {0}.HelperDB.ExecuteSql(sql);
////            //把原来nextid=previd换为id
////            sql = ""update "" + table + "" set nextid="" + id + "" where nextid="" + previd;
////            {0}.HelperDB.ExecuteSql(sql);
////
////            //处理提升的栏目nextid->previd,previd->previd_,orderid->orderid_
////            sql = ""update "" + table + "" set nextid="" + previd + "",previd="" + previd_ + "" where id="" + id;
////            {0}.HelperDB.ExecuteSql(sql);
////
////            int child_num = 0, child_num_ = 0;//两个栏目的子栏目数目
////            string[] temp;
////            string children, children_;
////            children = ""0"";
////            children_ = ""0"";
////
////            if (child > 0)
////            {{
////                children = getChildren(id);
////                temp = children.Split(' ', ' ');
////                child_num = temp.Length;
////            }}
////            if (child_ > 0)
////            {{
////                children_ = getChildren(previd);
////                temp = children_.Split(' ', ' ');
////                child_num_ = temp.Length;
////            }}
////
////            //处理上一个栏目nextid->nextid,previd->id
////            sql = ""update "" + table + "" set nextid="" + nextid + "",previd="" + id + "" where id="" + previd;
////            {0}.HelperDB.ExecuteSql(sql);
////
////            sql = ""update "" + table + "" set orderid=orderid - "" + (child_num_ + 1) + "" where id in ("" + (id + "","" + children) + "")"";
////            {0}.HelperDB.ExecuteSql(sql);
////            sql = ""update "" + table + "" set orderid=orderid + "" + (child_num + 1) + "" where id in ("" + (previd + "","" + children_) + "")"";
////            {0}.HelperDB.ExecuteSql(sql);
////
////            return 0;
////";
////            MethodUpClass1.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodUpClass1);
////            //upClass2
////            CodeMemberMethod MethodUpClass2 = new CodeMemberMethod();
////            MethodUpClass2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodUpClass2.Comments.Add(new CodeCommentStatement("向上移动栏目", true));
////            MethodUpClass2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodUpClass2.Comments.Add(new CodeCommentStatement("<param name=\"className\">要向上移动的栏目的名称</param>", true));
////            MethodUpClass2.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:要提升排序的栏目不存在 2:要提升排序的栏目上面没有栏目,无法被提升 3:要提升排序的栏目的这一级别只有它一个，没办法被提升 4:要提升排序的栏目的上面的栏目不存在,被非法删除 </returns>", true));
////            MethodUpClass2.Name = "upClass";
////            MethodUpClass2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodUpClass2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "className"));
////            MethodUpClass2.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            //先得到要提升的id的栏目信息
////            sql = ""select * from "" + table + "" ClassName = '"" + className + ""'"";
////            int id, orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                id = Convert.ToInt32(dr[""id""]);
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//要提升排序的栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (previd == 0)
////                return 2;//要提升排序的栏目上面没有栏目,无法被提升
////            if (nextid == 0 && previd == 0)
////                return 3;//要提升排序的栏目的这一级别只有它一个，没办法被提升
////
////            //得到上面一个栏目的信息
////            sql = ""select * from "" + table + "" where id="" + previd;
////            int orderid_ = 0, rootid_ = 0, previd_ = 0, nextid_ = 0, depth_ = 0, parentid_ = 0, child_ = 0;
////            dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                orderid_ = Convert.ToInt32(dr[""orderid""]);
////                rootid_ = Convert.ToInt32(dr[""rootid""]);
////                previd_ = Convert.ToInt32(dr[""previd""]);
////                nextid_ = Convert.ToInt32(dr[""nextid""]);
////                depth_ = Convert.ToInt32(dr[""depth""]);
////                parentid_ = Convert.ToInt32(dr[""parentid""]);
////                child_ = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 4;//要提升排序的栏目的上面的栏目不存在,被非法删除
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            //把原来previd=id的换为previd=previd
////            sql = ""update "" + table + "" set previd="" + previd + "" where previd="" + id;
////            {0}.HelperDB.ExecuteSql(sql);
////            //把原来nextid=previd换为id
////            sql = ""update "" + table + "" set nextid="" + id + "" where nextid="" + previd;
////            {0}.HelperDB.ExecuteSql(sql);
////
////            //处理提升的栏目nextid->previd,previd->previd_,orderid->orderid_
////            sql = ""update "" + table + "" set nextid="" + previd + "",previd="" + previd_ + "" where id="" + id;
////            {0}.HelperDB.ExecuteSql(sql);
////
////            int child_num = 0, child_num_ = 0;//两个栏目的子栏目数目
////            string[] temp;
////            string children, children_;
////            children = ""0"";
////            children_ = ""0"";
////
////            if (child > 0)
////            {{
////                children = getChildren(id);
////                temp = children.Split(' ', ' ');
////                child_num = temp.Length;
////            }}
////            if (child_ > 0)
////            {{
////                children_ = getChildren(previd);
////                temp = children_.Split(' ', ' ');
////                child_num_ = temp.Length;
////            }}
////
////            //处理上一个栏目nextid->nextid,previd->id
////            sql = ""update "" + table + "" set nextid="" + nextid + "",previd="" + id + "" where id="" + previd;
////            {0}.HelperDB.ExecuteSql(sql);
////
////            sql = ""update "" + table + "" set orderid=orderid - "" + (child_num_ + 1) + "" where id in ("" + (id + "","" + children) + "")"";
////            {0}.HelperDB.ExecuteSql(sql);
////            sql = ""update "" + table + "" set orderid=orderid + "" + (child_num + 1) + "" where id in ("" + (previd + "","" + children_) + "")"";
////            {0}.HelperDB.ExecuteSql(sql);
////
////            return 0;
////";
////            MethodUpClass2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodUpClass2);
////            //downClass1
////            CodeMemberMethod MethodDownClass1 = new CodeMemberMethod();
////            MethodDownClass1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDownClass1.Comments.Add(new CodeCommentStatement("向下移动栏目", true));
////            MethodDownClass1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDownClass1.Comments.Add(new CodeCommentStatement("<param name=\"id\">要向下移动的栏目的id</param>", true));
////            MethodDownClass1.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:要下降排序的栏目不存在 2:要下降排序的栏目下面没有栏目,无法被下降 3:要下降排序的栏目的这一级别只有它一个，没办法被提升</returns>", true));
////            MethodDownClass1.Name = "downClass";
////            MethodDownClass1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodDownClass1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodDownClass1.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            sql = ""select * from "" + table + "" where id="" + id;
////            int orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//要下降排序的栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (nextid == 0)
////                return 2;//要下降排序的栏目下面没有栏目,无法被下降
////            if (nextid == 0 && previd == 0)
////                return 3;//要下降排序的栏目的这一级别只有它一个，没办法被提升
////
////            return upClass(nextid);
////";
////            MethodDownClass1.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDownClass1);
////            //downClass2
////            CodeMemberMethod MethodDownClass2 = new CodeMemberMethod();
////            MethodDownClass2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodDownClass2.Comments.Add(new CodeCommentStatement("向下移动栏目", true));
////            MethodDownClass2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodDownClass2.Comments.Add(new CodeCommentStatement("<param name=\"className\">要向下移动的栏目的名称</param>", true));
////            MethodDownClass2.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:要下降排序的栏目不存在 2:要下降排序的栏目下面没有栏目,无法被下降 3:要下降排序的栏目的这一级别只有它一个，没办法被提升 </returns>", true));
////            MethodDownClass2.Name = "downClass";
////            MethodDownClass2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodDownClass2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "className"));
////            MethodDownClass2.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            sql = ""select * from "" + table + "" where  ClassName = '"" + className + ""'"";
////            int id, orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                id = Convert.ToInt32(dr[""id""]);
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            else
////            {{
////                dr.Close();
////                dr.Dispose();
////                return 1;//要下降排序的栏目不存在
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (nextid == 0)
////                return 2;//要下降排序的栏目下面没有栏目,无法被下降
////            if (nextid == 0 && previd == 0)
////                return 3;//要下降排序的栏目的这一级别只有它一个，没办法被提升
////
////            return upClass(nextid);
////";
////            MethodDownClass2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodDownClass2);
////            //moveClass
////            CodeMemberMethod MethodMoveClass = new CodeMemberMethod();
////            MethodMoveClass.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodMoveClass.Comments.Add(new CodeCommentStatement("移动栏目", true));
////            MethodMoveClass.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodMoveClass.Comments.Add(new CodeCommentStatement("<param name=\"id\">要向下移动的栏目的id</param>", true));
////            MethodMoveClass.Comments.Add(new CodeCommentStatement("<param name=\"target\"></param>", true));
////            MethodMoveClass.Comments.Add(new CodeCommentStatement("<returns>0:成功 1:要移动的栏目不存在 2:目标栏目不存在 3:不能指定该类别的下属类别作为所属类别 </returns>", true));
////            MethodMoveClass.Name = "moveClass";
////            MethodMoveClass.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodMoveClass.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodMoveClass.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "target"));
////            MethodMoveClass.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            if (!checkExist(id))
////                return 1;//要移动的栏目不存在
////            if (target != 0)
////            {{
////                if (!checkExist(target))
////                    return 2;//目标栏目不存在
////            }}
////
////            //要移动的类别的所有的子栏目
////            string moveclassids;
////            moveclassids = getChildren(id);
////            string[] arr = moveclassids.Split(',');
////            string temp = "","" + moveclassids;
////            if (temp.IndexOf("","" + target.ToString()) != -1)
////                return 3;//不能指定该类别的下属类别作为所属类别
////
////            string sql;
////
////            #region //先处理要移动的栏目的信息
////            string parentpath = """";
////            int orderid = 0, rootid = 0, previd = 0, nextid = 0, depth = 0, parentid = 0, child = 0;
////            int last_orderid = 0;
////            sql = ""select * from "" + table + "" where id="" + id;
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            if (dr.Read())
////            {{
////                parentpath = dr[""parentpath""].ToString();
////                orderid = Convert.ToInt32(dr[""orderid""]);
////                rootid = Convert.ToInt32(dr[""rootid""]);
////                previd = Convert.ToInt32(dr[""previd""]);
////                nextid = Convert.ToInt32(dr[""nextid""]);
////                depth = Convert.ToInt32(dr[""depth""]);
////                parentid = Convert.ToInt32(dr[""parentid""]);
////                child = Convert.ToInt32(dr[""child""]);
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            if (depth > 0)
////                //更新父系栏目的子栏目数目
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set child=child-1 where id="" + parentid);
////
////            //修改上一类别的NextID和下一类别的PrevID
////            if (previd > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set NextID="" + nextid + "" where id="" + previd);
////            if (nextid > 0)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set PrevID="" + previd + "" where id="" + nextid);
////
////            //得到要移动的栏目的子栏目里最大的orderid
////            if (child > 0)
////            {{
////                sql = ""select max(orderid) from "" + table + "" where id in ("" + moveclassids + "")"";
////                last_orderid = Convert.ToInt32({0}.HelperDB.GetSingle(sql));
////                //处理要移动的类别树后面的栏目的orderid,全部-(arr.Length+1)
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set orderid=orderid-"" + (arr.Length + 1) + "" where orderid>"" + last_orderid);
////            }}
////            else
////            {{
////                last_orderid = orderid;
////                //处理要移动的类别树后面的栏目的orderid,全部-1
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set orderid=orderid-1 where orderid>"" + last_orderid);
////            }}
////
////
////
////            #endregion
////
////            #region//处理目标类别的信息
////            string target_parentpath = ""0"";
////            int target_orderid = 0, target_rootid = 0, target_previd = 0, target_nextid = 0, target_depth = 0, target_parentid = 0, target_child = 0;
////            int target_last_child_classid = 0;
////            int target_last_orderid = 0;
////            string target_children = """";
////
////            #region//是不是作为一级栏目
////            if (target > 0)
////            {{
////                sql = ""select * from "" + table + "" where id="" + target;
////                dr = {0}.HelperDB.ExecuteReader(sql);
////                if (dr.Read())
////                {{
////                    target_parentpath = dr[""parentpath""].ToString() + "","" + target;//新的父系路径
////                    target_orderid = Convert.ToInt32(dr[""orderid""]);
////                    target_rootid = Convert.ToInt32(dr[""rootid""]);
////                    target_previd = Convert.ToInt32(dr[""previd""]);
////                    target_nextid = Convert.ToInt32(dr[""nextid""]);
////                    target_depth = Convert.ToInt32(dr[""depth""]);
////                    target_parentid = Convert.ToInt32(dr[""parentid""]);
////                    target_child = Convert.ToInt32(dr[""child""]);
////                }}
////                dr.Close();
////                dr.Dispose();
////                //更新目标栏目的子栏目数目
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set child=child+1 where id="" + target);
////
////                target_children = getChildren(target);
////                if (target_child > 0)
////                {{
////                    //如果有子栏目找到最后一个子栏目的orderid
////                    sql = ""select max(orderid) from "" + table + "" where id in ("" + target_children + "")"";
////                    target_last_orderid = Convert.ToInt32({0}.HelperDB.GetSingle(sql));
////                    //找到目标类别的一级子类别最后一个id,并更新它的nextid=id
////                    sql = ""select id from "" + table + "" where parentid="" + target + "" order by orderid desc"";
////                    object temp_ = {0}.HelperDB.GetSingle(sql);
////                    target_last_child_classid = Convert.ToInt32(temp_);
////                    {0}.HelperDB.ExecuteSql(""update "" + table + "" set nextid="" + id + "" where id="" + target_last_child_classid);
////                }}
////                else
////                {{
////                    target_last_orderid = target_orderid;
////                    target_last_child_classid = 0;
////                }}
////                if (child > 0)
////                    //处理目标类别树后面的栏目的orderid,全部加上(arr.Length+1)
////                    {0}.HelperDB.ExecuteSql(""update "" + table + "" set orderid=orderid + "" + (arr.Length + 1) + "" where orderid>"" + target_last_orderid);
////                else
////                    {0}.HelperDB.ExecuteSql(""update "" + table + "" set orderid=orderid + 1 where orderid>"" + target_last_orderid);
////            }}
////            else//作为一级类别
////            {{
////                //重新定义target_depth
////                target_depth = -1;
////                //重新定义target_last_orderid
////                if (child > 0)
////                    sql = ""select max(orderid) from "" + table + "" where id not in ("" + (id + "","" + moveclassids) + "")"";
////                //_______________________________________________________________这里解决当要移动的栏目有子栏目的时候,orderid出现的小问题.
////                else
////                    sql = ""select max(orderid) from "" + table + "" where id<>"" + id;//有可能要移动的类别在最后一个,这里把它排除
////                object _temp;
////                _temp = {0}.HelperDB.GetSingle(sql);
////                if (_temp != null)
////                    target_last_orderid = Convert.ToInt32(_temp);
////                //重新定义target_rootid
////                target_rootid = id;
////
////                //得到previd
////                sql = ""select max(id) from "" + table + "" where parentid=0 and id<>"" + id;
////                _temp = {0}.HelperDB.GetSingle(sql);
////                if (_temp != null)
////                {{
////                    target_previd = Convert.ToInt32(_temp);
////                    //修改上一个一级栏目的nextid
////                    {0}.HelperDB.ExecuteSql(""update "" + table + "" set nextid="" + id + "" where id="" + target_previd);
////                }}
////            }}
////            #endregion
////
////            #endregion
////
////            #region 综合处理
////
////            if (child > 0)//要移动的类别有子栏目
////            {{
////                int depth_d = 0;//depth的减量
////                if (target == 0)
////                    depth_d = depth;
////                else
////                    depth_d = depth - (target_depth + 1);
////                //更新字栏目的父系路径为 target_parentpath + "","" + id ,orderid
////                for (int x = 0; x < arr.Length; x++)
////                {{
////                    //注意这里要解决depth和parentpath的嵌套问题,即要移动的类别的子类别还有子类别
////                    string path;
////                    sql = ""select parentpath from "" + table + "" where id="" + arr[x];
////                    path = {0}.HelperDB.GetSingle(sql).ToString();
////                    path = path.Replace((parentpath + "","" + id), (target_parentpath + "","" + id));
////                    {0}.HelperDB.ExecuteSql(""update "" + table + "" set depth=depth - "" + depth_d + "", parentpath='"" + path + ""',rootid="" + target_rootid + "",orderid="" + (target_last_orderid + x + 2) + "" where id="" + arr[x]);
////                    //__________________________________________________________________________________________________________________________________________________________//其父系栏目已经加1,这里至少加2
////                }}
////            }}
////
////            if (target > 0)//更新要移动的类别的parentpath和previd,rootid,orderid,parentid,depth,nextid,target_previd
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set nextid=0,depth="" + (target_depth + 1) + "",parentid="" + target + "", parentpath='"" + target_parentpath + ""',previd="" + target_last_child_classid + "" ,rootid="" + target_rootid + "",orderid="" + (target_last_orderid + 1) + "" where id ="" + id);
////            else//区别在于previd
////                {0}.HelperDB.ExecuteSql(""update "" + table + "" set previd="" + target_previd + "",nextid=0,depth="" + (target_depth + 1) + "",parentid="" + target + "", parentpath='"" + target_parentpath + ""' ,rootid="" + target_rootid + "",orderid="" + (target_last_orderid + 1) + "" where id ="" + id);
////
////            #endregion
////            return 0;
////";
////            MethodMoveClass.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodMoveClass);
////            #endregion 移动栏目
////            #region 显示栏目列表的
////            //List1
////            CodeMemberMethod MethodList1 = new CodeMemberMethod();
////            MethodList1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodList1.Comments.Add(new CodeCommentStatement("显示全部栏目列表的datatable", true));
////            MethodList1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodList1.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodList1.Name = "list";
////            MethodList1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodList1.ReturnType = new CodeTypeReference("System.Collections.Generic.List<"+dbsAnalysisClass.Name+">");
////            MethodList1.Statements.Add(new CodeSnippetExpression("return list(0)"));
////            ctd1.Members.Add(MethodList1);
////            //List2
////            CodeMemberMethod MethodList2 = new CodeMemberMethod();
////            MethodList2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodList2.Comments.Add(new CodeCommentStatement("显示栏目列表的datatable", true));
////            MethodList2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodList2.Comments.Add(new CodeCommentStatement("<param name=\"ChildId\">要获得子栏目的 Id</param>", true));
////            MethodList2.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodList2.Name = "list";
////            MethodList2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodList2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "ChildId"));
////            MethodList2.ReturnType = new CodeTypeReference("System.Collections.Generic.List<" + dbsAnalysisClass.Name + ">");
////            str_temp = @"
////            if (ChildId == 0)
////            {{
////                return Select{0}(0, 1, """", ""OrderID"");
////            }}
////            else
////            {{
////                return Select{0}(0, 1, ""ParentPath + ',' like '%,"" + ChildId + "",%'"", ""OrderID"");
////            }}
////";
////            MethodList2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp,dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodList2);
////            //List3
////            CodeMemberMethod MethodList3 = new CodeMemberMethod();
////            MethodList3.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodList3.Comments.Add(new CodeCommentStatement("显示栏目列表的datatable", true));
////            MethodList3.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodList3.Comments.Add(new CodeCommentStatement("<param name=\"ClassName\">要获得子栏目的名称</param>", true));
////            MethodList3.Comments.Add(new CodeCommentStatement("<param name=\"IsLike\">是否模糊查找</param>", true));
////            MethodList3.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodList3.Name = "list";
////            MethodList3.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodList3.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ClassName"));
////            MethodList3.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Boolean), "IsLike"));
////            MethodList3.ReturnType = new CodeTypeReference("System.Collections.Generic.List<" + dbsAnalysisClass.Name + ">");
////            str_temp = @"
////            if (ClassName == """")
////            {{
////                return Select{0}(0, 1, """", ""OrderID"");
////            }}
////            else if (IsLike)
////            {{
////                return Select{0}(0, 1, ""ClassName + ',' like '%"" + ClassName + ""%'"", ""OrderID"");
////            }}
////            else
////            {{
////                return Select{0}(0, 1, ""ClassName = '"" + ClassName + ""'"", ""OrderID"");
////            }}
////    ";
////            MethodList3.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodList3);
////            //TreeList1
////            CodeMemberMethod MethodTreeList1 = new CodeMemberMethod();
////            MethodTreeList1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodTreeList1.Comments.Add(new CodeCommentStatement("显示栏目列表的" + dbsAnalysisClass.Name + "DataSource", true));
////            MethodTreeList1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodTreeList1.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodTreeList1.Name = "TreeList";
////            MethodTreeList1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodTreeList1.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name + "DataSource");
////            MethodTreeList1.Statements.Add(new CodeSnippetExpression("return " + dbsAnalysisClass.Name + "DataSource.Select()"));
////            ctd1.Members.Add(MethodTreeList1);
////            //TreeList2
////            CodeMemberMethod MethodTreeList2 = new CodeMemberMethod();
////            MethodTreeList2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodTreeList2.Comments.Add(new CodeCommentStatement("显示栏目列表的" + dbsAnalysisClass.Name + "DataSource", true));
////            MethodTreeList2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodTreeList2.Comments.Add(new CodeCommentStatement("<param name=\"id\">要获得子栏目的id</param>", true));
////            MethodTreeList2.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodTreeList2.Name = "TreeList";
////            MethodTreeList2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodTreeList2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodTreeList2.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name + "DataSource");
////            MethodTreeList2.Statements.Add(new CodeSnippetExpression("return " + dbsAnalysisClass.Name + "DataSource.Select(id)"));
////            ctd1.Members.Add(MethodTreeList2);
////            //TreeList3
////            CodeMemberMethod MethodTreeList3 = new CodeMemberMethod();
////            MethodTreeList3.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodTreeList3.Comments.Add(new CodeCommentStatement("显示栏目列表的" + dbsAnalysisClass.Name + "DataSource", true));
////            MethodTreeList3.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodTreeList3.Comments.Add(new CodeCommentStatement("<param name=\"ClassName\">要获得子栏目的名称</param>", true));
////            MethodTreeList3.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodTreeList3.Name = "TreeList";
////            MethodTreeList3.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodTreeList3.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ClassName"));
////            MethodTreeList3.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name + "DataSource");
////            MethodTreeList3.Statements.Add(new CodeSnippetExpression("return " + dbsAnalysisClass.Name + "DataSource.Select(ClassName)"));
////            ctd1.Members.Add(MethodTreeList3);
////            #endregion 显示栏目列表的
////            #region 复位
////            //reset
////            CodeMemberMethod MethodReset = new CodeMemberMethod();
////            MethodReset.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodReset.Comments.Add(new CodeCommentStatement("复位", true));
////            MethodReset.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodReset.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodReset.Name = "reset";
////            MethodReset.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodReset.ReturnType = new CodeTypeReference(typeof(Int32));
////            str_temp = @"
////            string sql;
////            System.Collections.ArrayList arr = new System.Collections.ArrayList();
////            int PrevID, NextID;
////
////            PrevID = 0;
////            sql = ""select id From "" + table + "" order by RootID,OrderID"";
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////
////            while (dr.Read())
////            {{
////                arr.Add(dr[""id""]);
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            for (int j = 0; j < arr.Count; j++)
////            {{
////                if (j == arr.Count - 1)
////                    NextID = 0;
////                else
////                    NextID = Convert.ToInt32(arr[j + 1]);
////
////                sql = ""update "" + table + "" set RootID="" + arr[j] + "",OrderID="" + (j + 1) + "",ParentID=0,Child=0,ParentPath='0',Depth=0,PrevID="" + PrevID + "",NextID="" + NextID + "" where id="" + arr[j];
////                {0}.HelperDB.ExecuteSql(sql);
////                PrevID = Convert.ToInt32(arr[j]);
////            }}
////            return 0;
////";
////            MethodReset.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodReset);
////            #endregion 复位
////            #region 检查栏目是否存在
////            //checkExist1
////            CodeMemberMethod MethodCheckExist1 = new CodeMemberMethod();
////            MethodCheckExist1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodCheckExist1.Comments.Add(new CodeCommentStatement("检查栏目是否存在", true));
////            MethodCheckExist1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodCheckExist1.Comments.Add(new CodeCommentStatement("<param name=\"id\"></param>", true));
////            MethodCheckExist1.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodCheckExist1.Name = "checkExist";
////            MethodCheckExist1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodCheckExist1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodCheckExist1.ReturnType = new CodeTypeReference(typeof(bool));
////            str_temp = @"
////            string sql;
////            sql = ""select rootid From "" + table + "" where id="" + id;
////            if ({0}.HelperDB.GetSingle(sql) == null)
////            {{
////                return false;
////            }}
////            else
////            {{
////                return true;
////            }}
////";
////            MethodCheckExist1.Statements.Add(new CodeSnippetExpression(string.Format(str_temp,dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodCheckExist1);
////            //checkExist2
////            CodeMemberMethod MethodCheckExist2 = new CodeMemberMethod();
////            MethodCheckExist2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodCheckExist2.Comments.Add(new CodeCommentStatement("检查栏目是否存在", true));
////            MethodCheckExist2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodCheckExist2.Comments.Add(new CodeCommentStatement("<param name=\"className\"></param>", true));
////            MethodCheckExist2.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodCheckExist2.Name = "checkExist";
////            MethodCheckExist2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodCheckExist2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "className"));
////            MethodCheckExist2.ReturnType = new CodeTypeReference(typeof(bool));
////            str_temp = @"
////            string sql;
////            sql = ""select rootid From "" + table + "" where className='"" + className + ""'"";
////            if ({0}.HelperDB.GetSingle(sql) == null)
////            {{
////                return false;
////            }}
////            else
////            {{
////                return true;
////            }}
////";
////            MethodCheckExist2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodCheckExist2);
////            #endregion 检查栏目是否存在
////            #region 得到 ListItem 栏目列表
////            //getListItem1
////            CodeMemberMethod MethodGetListItem1 = new CodeMemberMethod();
////            MethodGetListItem1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetListItem1.Comments.Add(new CodeCommentStatement("得到 ListItem 栏目列表", true));
////            MethodGetListItem1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetListItem1.Comments.Add(new CodeCommentStatement("<param name=\"rootClassId\"></param>", true));
////            MethodGetListItem1.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetListItem1.Name = "getListItem";
////            MethodGetListItem1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetListItem1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "rootClassId"));
////            MethodGetListItem1.ReturnType = new CodeTypeReference("System.Collections.Generic.List<System.Web.UI.WebControls.ListItem>");
////            MethodGetListItem1.Statements.Add(new CodeSnippetExpression("return getListItem(0, rootClassId, 0)"));
////            ctd1.Members.Add(MethodGetListItem1);
////            //getListItem2
////            CodeMemberMethod MethodGetListItem2 = new CodeMemberMethod();
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("得到 ListItem 栏目列表", true));
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("<param name=\"type\">0:显示\"请先添加类别\";1:显示\"无（作为一级类别）\"2:没有子栏目Value设为\"0\"</param>", true));
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("<param name=\"rootClassId\"></param>", true));
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("<param name=\"selected\"></param>", true));
////            MethodGetListItem2.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetListItem2.Name = "getListItem";
////            MethodGetListItem2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetListItem2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(int), "type"));
////            MethodGetListItem2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(int), "rootClassId"));
////            MethodGetListItem2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(int), "selected"));
////            MethodGetListItem2.ReturnType = new CodeTypeReference("System.Collections.Generic.List<System.Web.UI.WebControls.ListItem>");
////            str_temp = @"
////            System.Collections.Generic.List<System.Web.UI.WebControls.ListItem> lic = new System.Collections.Generic.List<System.Web.UI.WebControls.ListItem>();
////            int rootDepth = rootClassId == 0 ? 0 : Select{0}(rootClassId).Depth + 1;
////            System.Collections.Generic.List<{0}> dt = {0}.list(rootClassId);//得到列表
////            if (dt.Count == 0 && type == 0)//显示""请先添加类别""
////            {{
////                System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem(""请先添加类别"", """");
////                lic.Add(li);
////                return lic;
////            }}
////            if (type == 1)//显示""无（作为一级类别）""
////            {{
////                System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem(""无（作为一级类别）"", ""0"");
////                lic.Add(li);
////            }}
////
////            foreach ({0} dr in dt)
////            {{
////                System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem();
////
////                int tmpDepth = dr.Depth - rootDepth;
////                int NextID = dr.NextID;
////                int id = dr.Id;
////                int child = dr.Child;
////                string classname = dr.ClassName;
////
////                try
////                {{
////                    ShowLine[tmpDepth] = NextID > 0 ? true : false;//这个值是经常被修改的.
////                }}
////                catch//(Exception ex)
////                {{
////                    ShowLine.Add(false);
////                    ShowLine[tmpDepth] = NextID > 0 ? true : false;//这个值是经常被修改的.
////                }}
////                //默认选择的项
////                if (id == selected)
////                {{
////                    li.Selected = true;
////                    li.Value = id.ToString();
////                }}
////                else
////                {{
////                    if (type == 2 && child > 0)//添加文章的时候,有子栏目的栏目的value这里也设置为0
////                        li.Value = ""0"";
////                    else
////                        li.Value = id.ToString();
////                }}
////                li.Text = """";
////                if (tmpDepth > 0)
////                {{
////                    for (int j = 1; j <= tmpDepth; j++)
////                    {{
////                        li.Text += nbsp + nbsp;// ""&nbsp;&nbsp;"";
////                        if (j == tmpDepth)
////                        {{
////                            if (NextID > 0)
////                                li.Text += ""├"" + nbsp;
////                            else
////                                li.Text += ""└"" + nbsp;
////                        }}
////                        else
////                        {{
////                            if ((bool)ShowLine[j])
////                                li.Text += ""│"";
////                            else
////                                li.Text += nbsp;
////                        }}
////                    }}
////                }}
////                li.Text += classname;
////                lic.Add(li);
////            }}
////
////            return lic;
////";
////            MethodGetListItem2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodGetListItem2);
////            #endregion 得到 ListItem 栏目列表
////            #region 根据id得到栏目名称
////            //getClassName
////            CodeMemberMethod MethodGetClassName = new CodeMemberMethod();
////            MethodGetClassName.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetClassName.Comments.Add(new CodeCommentStatement("根据id得到栏目名称", true));
////            MethodGetClassName.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetClassName.Comments.Add(new CodeCommentStatement("<param name=\"id\"></param>", true));
////            MethodGetClassName.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetClassName.Name = "getClassName";
////            MethodGetClassName.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetClassName.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodGetClassName.ReturnType = new CodeTypeReference(typeof(string));
////            MethodGetClassName.Statements.Add(new CodeSnippetExpression("return Select"+dbsAnalysisClass.Name+"(id).ClassName"));
////            ctd1.Members.Add(MethodGetClassName);
////            #endregion 根据id得到栏目名称
////            #region 得到栏目的排的顺序
////            //getClassName
////            CodeMemberMethod MethodGetClassidOrderNum = new CodeMemberMethod();
////            MethodGetClassidOrderNum.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetClassidOrderNum.Comments.Add(new CodeCommentStatement("得到栏目的排的顺序", true));
////            MethodGetClassidOrderNum.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetClassidOrderNum.Comments.Add(new CodeCommentStatement("<param name=\"id\"></param>", true));
////            MethodGetClassidOrderNum.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetClassidOrderNum.Name = "getClassidOrderNum";
////            MethodGetClassidOrderNum.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetClassidOrderNum.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodGetClassidOrderNum.ReturnType = new CodeTypeReference(typeof(int));
////            str_temp = @"
////            string sql;
////            int i = 0;
////            sql = ""select id From "" + table + "" order by RootID,OrderID"";
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            while (dr.Read())
////            {{
////                i = i + 1;
////                if (Convert.ToInt32(dr[""id""]) == id)
////                    break;
////                else
////                {{
////                    continue;
////                }}
////            }}
////            dr.Close();
////            dr.Dispose();
////            return i;
////";
////            MethodGetClassidOrderNum.Statements.Add(new CodeSnippetExpression(string.Format(str_temp,dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodGetClassidOrderNum);
////            #endregion 得到栏目的排的顺序
           
////            #region 罗列一栏目下的所有级别的子栏目
////            //getChildren
////            CodeMemberMethod MethodGetChildren = new CodeMemberMethod();
////            MethodGetChildren.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetChildren.Comments.Add(new CodeCommentStatement("罗列一栏目下的所有级别的子栏目", true));
////            MethodGetChildren.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetChildren.Comments.Add(new CodeCommentStatement("<param name=\"id\"></param>", true));
////            MethodGetChildren.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetChildren.Name = "getChildren";
////            MethodGetChildren.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetChildren.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodGetChildren.ReturnType = new CodeTypeReference(typeof(string));
////            str_temp = @"
////            System.Text.StringBuilder sb = new System.Text.StringBuilder();
////            string sql;
////            if (id <= 0)
////                return """";
////            sql = ""select id from "" + table + "" where  ParentPath + ',' like '%,"" + id + "",%' order by orderid"";
////            //_____________________________________________________________________________________按照先后顺序
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            while (dr.Read())
////            {{
////                sb.Append(dr[0].ToString() + "","");
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            string rtn = sb.ToString();
////            if (rtn != """")
////                rtn = rtn.Substring(0, rtn.Length - 1);//去掉末尾的"",""
////            return rtn;
////";
////            MethodGetChildren.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodGetChildren);
////            #endregion 罗列一栏目下的所有级别的子栏目
////            #region 罗列一栏目下的子栏目
////            //getChild1
////            CodeMemberMethod MethodGetChild1 = new CodeMemberMethod();
////            MethodGetChild1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetChild1.Comments.Add(new CodeCommentStatement("罗列一栏目下的子栏目", true));
////            MethodGetChild1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetChild1.Comments.Add(new CodeCommentStatement("<param name=\"ChildId\"></param>", true));
////            MethodGetChild1.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetChild1.Name = "getChild";
////            MethodGetChild1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetChild1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "ChildId"));
////            MethodGetChild1.ReturnType = new CodeTypeReference("System.Collections.Generic.List<"+dbsAnalysisClass.Name+">");
////            str_temp = @"
////            if (ChildId <= 0)
////                ChildId = 0;
////            return Select{0}(0, 1, ""ParentID="" + ChildId + """", ""orderid"");
////";
////            MethodGetChild1.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodGetChild1);
////            //getChild2
////            CodeMemberMethod MethodGetChild2 = new CodeMemberMethod();
////            MethodGetChild2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodGetChild2.Comments.Add(new CodeCommentStatement("罗列一栏目下的子栏目", true));
////            MethodGetChild2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodGetChild2.Comments.Add(new CodeCommentStatement("<param name=\"ClassName\"></param>", true));
////            MethodGetChild2.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodGetChild2.Name = "getChild";
////            MethodGetChild2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodGetChild2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ClassName"));
////            MethodGetChild2.ReturnType = new CodeTypeReference("System.Collections.Generic.List<" + dbsAnalysisClass.Name + ">");
////            str_temp = @"
////            return getChild({0}.Select{0}(ClassName).Id);
////";
////            MethodGetChild2.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodGetChild2);
////            #endregion 罗列一栏目下的子栏目
////            #region 栏目map
////            //classMap
////            CodeMemberMethod MethodClassMap = new CodeMemberMethod();
////            MethodClassMap.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodClassMap.Comments.Add(new CodeCommentStatement("栏目map", true));
////            MethodClassMap.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodClassMap.Comments.Add(new CodeCommentStatement("<param name=\"id\"></param>", true));
////            MethodClassMap.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodClassMap.Name = "classMap";
////            MethodClassMap.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodClassMap.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Int32), "id"));
////            MethodClassMap.ReturnType = new CodeTypeReference(typeof(string));
////            str_temp = @"
////            string sql;
////            object temp;
////            sql = ""select parentid from "" + table + "" where id="" + id;
////            temp = {0}.HelperDB.GetSingle(sql);
////            if (temp == null)
////                return """";
////            else
////            {{
////                if (Convert.ToInt32(temp) == 0)
////                    return ""一级栏目"";
////            }}
////
////            System.Text.StringBuilder sb = new System.Text.StringBuilder();
////            //栏目路径
////            string parentpath;
////            parentpath = (string){0}.HelperDB.GetSingle(""select parentpath from "" + table + "" where id="" + id);
////            sql = ""Select * From "" + table + "" where id in ("" + parentpath + "") order by Depth"";
////            System.Data.IDataReader dr = {0}.HelperDB.ExecuteReader(sql);
////            while (dr.Read())
////            {{
////                int Depth = Convert.ToInt32(dr[""Depth""]);
////                string classname = (string)dr[""classname""];
////                for (int i = 1; i <= Depth; i++) {{ sb.Append(""&nbsp;&nbsp;&nbsp;""); }}
////                if (Depth > 0)
////                    sb.Append(""└"");
////                sb.AppendFormat(""&nbsp;{{0}}<br />"", classname);
////            }}
////            dr.Close();
////            dr.Dispose();
////
////            return sb.ToString();
////";
////            MethodClassMap.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodClassMap);
////            #endregion 栏目map
////            #region 显示列表的时候的repeater的itemcreated事件
////            //itemcreated
////            CodeMemberMethod MethodItemcreated = new CodeMemberMethod();
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("<summary>", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("显示列表的时候的repeater的itemcreated事件", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("</summary>", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("<param name=\"Sender\"></param>", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("<param name=\"e\"></param>", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("<param name=\"ctlname\"></param>", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("<param name=\"ctlname2\"></param>", true));
////            MethodItemcreated.Comments.Add(new CodeCommentStatement("<returns></returns>", true));
////            MethodItemcreated.Name = "itemcreated";
////            MethodItemcreated.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodItemcreated.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "Sender"));
////            MethodItemcreated.Parameters.Add(new CodeParameterDeclarationExpression(typeof(System.Web.UI.WebControls.RepeaterItemEventArgs), "e"));
////            MethodItemcreated.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ctlname"));
////            MethodItemcreated.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ctlname2"));
////            str_temp = @"
////            System.Data.DataRowView dv = (System.Data.DataRowView)e.Item.DataItem;
////            int iDepth = Convert.ToInt32(dv[""Depth""]);
////            int NextID = Convert.ToInt32(dv[""NextID""]);
////            int Child = Convert.ToInt32(dv[""Child""]);
////
////            try
////            {{
////                ShowLine[iDepth] = Convert.ToInt32(dv[""NextID""]) > 0 ? true : false;//这个值是经常被修改的.
////            }}
////            catch (Exception ex)
////            {{
////                ShowLine.Add(false);
////                ShowLine[iDepth] = Convert.ToInt32(dv[""NextID""]) > 0 ? true : false;//这个值是经常被修改的.
////            }}
////
////            System.Web.UI.WebControls.Literal l = new System.Web.UI.WebControls.Literal();
////            l = (System.Web.UI.WebControls.Literal)e.Item.FindControl(ctlname);
////            string text = """";
////            string text2 = """";
////
////            if (iDepth > 0)
////            {{
////                for (int i = 1; i <= iDepth; i++)
////                {{
////                    if (i == iDepth)
////                    {{
////                        if (NextID > 0)
////                            text += ""<img src='images/tree_line1.gif' width='17' height='16' valign='abvmiddle'>"";
////                        else
////                            text += ""<img src='images/tree_line2.gif' width='17' height='16' valign='abvmiddle'>"";
////                    }}
////                    else//这个判断主要是看iDepth以前的要显示|,还是显示空填充
////                    {{
////                        if ((bool)ShowLine[i])
////                            text += ""<img src='images/tree_line3.gif' width='17' height='16' valign='abvmiddle'>"";
////                        else
////                            text += ""<img src='images/tree_line4.gif' width='17' height='16' valign='abvmiddle'>"";
////                    }}
////                }}
////            }}
////
////            if (Child > 0)
////            {{
////                text2 = ""（"" + Child + ""）"";//()里的数字,表示子栏目数目
////                text += ""<img src='Images/tree_folder4.gif' width='15' height='15' valign='abvmiddle'>"";
////            }}
////            else
////                text += ""<img src='Images/tree_folder3.gif' width='15' height='15' valign='abvmiddle'>"";
////
////            l.Text = text;
////
////            System.Web.UI.WebControls.Literal l2 = (System.Web.UI.WebControls.Literal)e.Item.FindControl(ctlname2);
////            l2.Text = text2;
////";
////            MethodItemcreated.Statements.Add(new CodeSnippetExpression(string.Format(str_temp, dbsAnalysisClass.Name)));
////            ctd1.Members.Add(MethodItemcreated);
////            #endregion 显示列表的时候的repeater的itemcreated事件
////            #endregion
//            dbsAnalysisClass.Namespace.GetNamespace().Types.Add(ctd1);
////             #endregion

////            #region  CatalogHierarchyData
////            #region 生成类
////            CodeTypeDeclaration ctd2 = new CodeTypeDeclaration(dbsAnalysisClass.Name + "HierarchyData");//生成类
////            ctd2.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" Copyright (C) " + System.DateTime.Today.Year + "  毛才君 版权所有。", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 文件编号：      ", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 文 件 名：      ", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 文件功能描述：  " + dbsAnalysisClass.Name + "的 IHierarchyData 类", false));
////            ctd2.Comments.Add(new CodeCommentStatement("", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 创建标识：      毛才君    " + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "", false));
////            ctd2.Comments.Add(new CodeCommentStatement("", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd2.Comments.Add(new CodeCommentStatement("", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd2.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd2.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));

////            ctd2.IsClass = true;
////            ctd2.Attributes = MemberAttributes.Public;
////            ctd2.BaseTypes.Add(typeof(System.Web.UI.IHierarchyData));
////            //生成类注释
////            ctd2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            ctd2.Comments.Add(new CodeCommentStatement(dbsAnalysisClass.Name + "的 IHierarchyData 类", true));
////            ctd2.Comments.Add(new CodeCommentStatement("</summary>", true));


////            //ctd2.Members.Add(new CodeMemberField(dbsAnalysisClass.Name+Config.DB_CLASS, "obj=null"));

////            #endregion

////            #region 构造函数
////            //参数构造函数
////            CodeConstructor constructor = new CodeConstructor();
////            constructor.Attributes = MemberAttributes.Public;
////            constructor.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "HierarchyData 的构造函数", true));
////            constructor.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor.Name = dbsAnalysisClass.Name + "HierarchyData";
////            constructor.Parameters.Add(new CodeParameterDeclarationExpression(dbsAnalysisClass.Name, "obj"));
////            constructor.Statements.Add(new CodeSnippetExpression("this.catalogObject = obj"));
////            ctd2.Members.Add(constructor);
////            #endregion 构造函数
////            #region 生成类字段

////            //生成类的 私有字段
////            CodeMemberField FieldcatalogObject = new CodeMemberField();
////            FieldcatalogObject.Attributes = MemberAttributes.Private;
////            FieldcatalogObject.Type = new CodeTypeReference(dbsAnalysisClass.Name);
////            FieldcatalogObject.Name = "catalogObject= null";
////            ctd2.Members.Add(FieldcatalogObject);
////            #endregion
////            #region 生成 属性
////            foreach (ModelDBField var in dbsAnalysisClass.Property)
////            {
////                //生成类的属性注释 和 属性
////                CodeMemberProperty cmp = new CodeMemberProperty();
////                cmp.Comments.Add(new CodeCommentStatement("<summary>", true));
////                cmp.Comments.Add(new CodeCommentStatement(var.Summary, true));
////                cmp.Comments.Add(new CodeCommentStatement("</summary>", true));
////                cmp.Attributes = MemberAttributes.Public;
////                cmp.Type = new CodeTypeReference(var.Type);
////                cmp.Name = var.Name;
////                cmp.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "catalogObject." + var.Name)));
////                cmp.SetStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "catalogObject." + var.Name), new CodePropertySetValueReferenceExpression()));
////                ctd2.Members.Add(cmp);
////            }

////            #endregion
////            #region IHierarchyData 接口
////            //HasChildren
////            CodeMemberProperty PropertyHasChildren = new CodeMemberProperty();
////            PropertyHasChildren.Attributes = MemberAttributes.Public;
////            PropertyHasChildren.Type = new CodeTypeReference("System.Boolean");
////            PropertyHasChildren.Name = "HasChildren";
////            PropertyHasChildren.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "catalogObject.Child != 0")));
////            ctd2.Members.Add(PropertyHasChildren);
////            //Item
////            CodeMemberProperty PropertyItem = new CodeMemberProperty();
////            PropertyItem.Attributes = MemberAttributes.Public;
////            PropertyItem.Type = new CodeTypeReference("System.Object");
////            PropertyItem.Name = "Item";
////            PropertyItem.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "catalogObject")));
////            ctd2.Members.Add(PropertyItem);
////            //Path
////            CodeMemberProperty PropertyPath = new CodeMemberProperty();
////            PropertyPath.Attributes = MemberAttributes.Public;
////            PropertyPath.Type = new CodeTypeReference(typeof(string));
////            PropertyPath.Name = "Path";
////            PropertyPath.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "catalogObject.ParentPath")));
////            ctd2.Members.Add(PropertyPath);
////            //Type
////            CodeMemberProperty PropertyType = new CodeMemberProperty();
////            PropertyType.Attributes = MemberAttributes.Public;
////            PropertyType.Type = new CodeTypeReference(typeof(string));
////            PropertyType.Name = "Type";
////            PropertyType.GetStatements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression("\"catalogObject\"")));
////            ctd2.Members.Add(PropertyType);
////            //ToString
////            CodeMemberMethod MethodToString = new CodeMemberMethod();
////            MethodToString.Name = "ToString";
////            MethodToString.Attributes = MemberAttributes.Public | MemberAttributes.Override;
////            MethodToString.ReturnType = new CodeTypeReference(typeof(string));
////            MethodToString.Statements.Add(new CodeSnippetExpression("return catalogObject.ClassName"));
////            ctd2.Members.Add(MethodToString);
////            //GetParent
////            CodeMemberMethod MethodGetParent = new CodeMemberMethod();
////            MethodGetParent.Name = "GetParent";
////            MethodGetParent.Attributes = MemberAttributes.Public;
////            MethodGetParent.ReturnType = new CodeTypeReference(typeof(System.Web.UI.IHierarchyData));
////            MethodGetParent.Statements.Add(new CodeSnippetExpression("return new " + dbsAnalysisClass.Name + "HierarchyData(" + dbsAnalysisClass .Name+ "."+string.Format(Config.DbMemberMethodSelect,dbsAnalysisClass .Name)+"(catalogObject.ParentID))"));
////            ctd2.Members.Add(MethodGetParent);
////            //GetChildren
////            CodeMemberMethod MethodGetChildren1 = new CodeMemberMethod();
////            MethodGetChildren1.Name = "GetChildren";
////            MethodGetChildren1.Attributes = MemberAttributes.Public;
////            MethodGetChildren1.ReturnType = new CodeTypeReference(typeof(System.Web.UI.IHierarchicalEnumerable));
////            MethodGetChildren1.Statements.Add(new CodeSnippetExpression(dbsAnalysisClass.Name + "HierarchicalEnumerable children = new " + dbsAnalysisClass.Name + "HierarchicalEnumerable()"));
////            MethodGetChildren1.Statements.Add(new CodeSnippetStatement("foreach (" + dbsAnalysisClass.Name + " cg in " + dbsAnalysisClass.Name + ".getChild(catalogObject.Id)){"));
////            MethodGetChildren1.Statements.Add(new CodeSnippetExpression("children.Add(new " + dbsAnalysisClass.Name + "HierarchyData(cg))"));
////            MethodGetChildren1.Statements.Add(new CodeSnippetStatement("}"));
////            MethodGetChildren1.Statements.Add(new CodeSnippetExpression("return children"));
////            ctd2.Members.Add(MethodGetChildren1);
            
////            #endregion
////            Namespace.Types.Add(ctd2);
////            #endregion

////            #region  CatalogHierarchicalEnumerable
////            #region 生成类
////            CodeTypeDeclaration ctd3 = new CodeTypeDeclaration(dbsAnalysisClass.Name + "HierarchicalEnumerable");//生成类
////            ctd3.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" Copyright (C) " + System.DateTime.Today.Year + "  毛才君 版权所有。", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 文件编号：      ", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 文 件 名：      ", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 文件功能描述：  " + dbsAnalysisClass.Name + "的 HierarchicalEnumerable 类", false));
////            ctd3.Comments.Add(new CodeCommentStatement("", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 创建标识：      毛才君    " + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "", false));
////            ctd3.Comments.Add(new CodeCommentStatement("", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd3.Comments.Add(new CodeCommentStatement("", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd3.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd3.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));

////            ctd3.IsClass = true;
////            ctd3.Attributes = MemberAttributes.Public;
////            ctd3.BaseTypes.Add(typeof(System.Collections.ArrayList));
////            ctd3.BaseTypes.Add(typeof(System.Web.UI.IHierarchicalEnumerable));
////            //生成类注释
////            ctd3.Comments.Add(new CodeCommentStatement("<summary>", true));
////            ctd3.Comments.Add(new CodeCommentStatement(dbsAnalysisClass.Name + "的 HierarchicalEnumerable 类", true));
////            ctd3.Comments.Add(new CodeCommentStatement("</summary>", true));


////            //ctd3.Members.Add(new CodeMemberField(dbsAnalysisClass.Name+Config.DB_CLASS, "obj=null"));

////            #endregion
////            #region 构造函数
////            //参数构造函数
////            CodeConstructor constructor1 = new CodeConstructor();
////            constructor1.Attributes = MemberAttributes.Public;
////            constructor1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor1.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "HierarchicalEnumerable 的构造函数", true));
////            constructor1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor1.Name = dbsAnalysisClass.Name + "HierarchicalEnumerable";
////            ctd3.Members.Add(constructor1);
////            #endregion 构造函数

////            #region IHierarchicalEnumerable 接口
////            //GetHierarchyData
////            CodeMemberMethod MethodGetHierarchyData = new CodeMemberMethod();
////            MethodGetHierarchyData.Name = "GetHierarchyData";
////            MethodGetHierarchyData.Attributes = MemberAttributes.Public;
////            MethodGetHierarchyData.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "enumeratedItem"));
////            MethodGetHierarchyData.ReturnType = new CodeTypeReference(typeof(System.Web.UI.IHierarchyData));
////            MethodGetHierarchyData.Statements.Add(new CodeSnippetExpression("return enumeratedItem as System.Web.UI.IHierarchyData"));
////            ctd3.Members.Add(MethodGetHierarchyData);
            
////            #endregion
////            Namespace.Types.Add(ctd3);
////            #endregion

////            #region  CatalogDataSourceView
////            #region 生成类
////            CodeTypeDeclaration ctd4 = new CodeTypeDeclaration(dbsAnalysisClass.Name + "DataSourceView");//生成类
////            ctd4.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" Copyright (C) " + System.DateTime.Today.Year + "  毛才君 版权所有。", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 文件编号：      ", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 文 件 名：      ", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 文件功能描述：  " + dbsAnalysisClass.Name + "的 DataSourceView 类", false));
////            ctd4.Comments.Add(new CodeCommentStatement("", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 创建标识：      毛才君    " + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "", false));
////            ctd4.Comments.Add(new CodeCommentStatement("", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd4.Comments.Add(new CodeCommentStatement("", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd4.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd4.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));

////            ctd4.IsClass = true;
////            ctd4.Attributes = MemberAttributes.Public;
////            ctd4.BaseTypes.Add(typeof(System.Web.UI.HierarchicalDataSourceView));
////            //生成类注释
////            ctd4.Comments.Add(new CodeCommentStatement("<summary>", true));
////            ctd4.Comments.Add(new CodeCommentStatement(dbsAnalysisClass.Name + "的 DataSourceView 类", true));
////            ctd4.Comments.Add(new CodeCommentStatement("</summary>", true));


////            //ctd4.Members.Add(new CodeMemberField(dbsAnalysisClass.Name+Config.DB_CLASS, "obj=null"));

////            #endregion
////            #region 构造函数
////            //参数构造函数
////            CodeConstructor constructor2 = new CodeConstructor();
////            constructor2.Attributes = MemberAttributes.Public;
////            constructor2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor2.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "DataSourceView 的构造函数", true));
////            constructor2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor2.Name = dbsAnalysisClass.Name + "DataSourceView";
////            ctd4.Members.Add(constructor2);
////            CodeConstructor constructor2_1 = new CodeConstructor();
////            constructor2_1.Attributes = MemberAttributes.Public;
////            constructor2_1.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor2_1.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "DataSourceView 的构造函数", true));
////            constructor2_1.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor2_1.Name = dbsAnalysisClass.Name + "DataSourceView";
////            constructor2_1.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "viewPath"));
////            constructor2_1.Statements.Add(new CodeSnippetExpression("this._viewPath = viewPath"));
////            ctd4.Members.Add(constructor2_1);

////            CodeConstructor constructor2_2 = new CodeConstructor();
////            constructor2_2.Attributes = MemberAttributes.Public;
////            constructor2_2.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor2_2.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "DataSourceView 的构造函数", true));
////            constructor2_2.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor2_2.Name = dbsAnalysisClass.Name + "DataSourceView";
////            constructor2_2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "viewPath"));
////            constructor2_2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(int), "id"));
////            constructor2_2.Statements.Add(new CodeSnippetExpression("this._viewPath = viewPath"));
////            constructor2_2.Statements.Add(new CodeSnippetExpression("this._classid = id"));


////            ctd4.Members.Add(constructor2_2);
////            CodeConstructor constructor2_3 = new CodeConstructor();
////            constructor2_3.Attributes = MemberAttributes.Public;
////            constructor2_3.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor2_3.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "DataSourceView 的构造函数", true));
////            constructor2_3.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor2_3.Name = dbsAnalysisClass.Name + "DataSourceView";
////            constructor2_3.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "viewPath"));
////            constructor2_3.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ClassName"));
////            constructor2_3.Statements.Add(new CodeSnippetExpression("this._viewPath = viewPath"));
////            constructor2_3.Statements.Add(new CodeSnippetExpression("this._classname = ClassName"));

////            ctd4.Members.Add(constructor2_3);
////            #endregion 构造函数
////            #region 生成类字段

////            //生成类的 私有字段
////            //_viewPath
////            CodeMemberField Field_viewPath = new CodeMemberField();
////            Field_viewPath.Attributes = MemberAttributes.Private;
////            Field_viewPath.Type = new CodeTypeReference(typeof(string));
////            Field_viewPath.Name = "_viewPath";
////            ctd4.Members.Add(Field_viewPath);
////            //_classname
////            CodeMemberField Field_classname = new CodeMemberField();
////            Field_classname.Attributes = MemberAttributes.Private;
////            Field_classname.Type = new CodeTypeReference(typeof(string));
////            Field_classname.Name = "_classname=\"\"";
////            ctd4.Members.Add(Field_classname);
////            //_classid
////            CodeMemberField Field_classid = new CodeMemberField();
////            Field_classid.Attributes = MemberAttributes.Private;
////            Field_classid.Type = new CodeTypeReference(typeof(Int32));
////            Field_classid.Name = "_classid=0";
////            ctd4.Members.Add(Field_classid);
////            #endregion
////            #region 生成 属性
////            //ClassName
////            CodeMemberProperty PropertyClassName = new CodeMemberProperty();
////            PropertyClassName.Comments.Add(new CodeCommentStatement("<summary>", true));
////            PropertyClassName.Comments.Add(new CodeCommentStatement("栏目名称", true));
////            PropertyClassName.Comments.Add(new CodeCommentStatement("</summary>", true));
////            PropertyClassName.Attributes = MemberAttributes.Public;
////            PropertyClassName.Type = new CodeTypeReference(typeof(string));
////            PropertyClassName.Name = "ClassName";
////            PropertyClassName.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "_classname")));
////            PropertyClassName.SetStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "_classname"), new CodePropertySetValueReferenceExpression()));
////            ctd4.Members.Add(PropertyClassName);
////            //id
////            CodeMemberProperty Propertyid = new CodeMemberProperty();
////            Propertyid.Comments.Add(new CodeCommentStatement("<summary>", true));
////            Propertyid.Comments.Add(new CodeCommentStatement("栏目id", true));
////            Propertyid.Comments.Add(new CodeCommentStatement("</summary>", true));
////            Propertyid.Attributes = MemberAttributes.Public;
////            Propertyid.Type = new CodeTypeReference(typeof(Int32));
////            Propertyid.Name = "id";
////            Propertyid.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "_classid")));
////            Propertyid.SetStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "_classid"), new CodePropertySetValueReferenceExpression()));
////            ctd4.Members.Add(Propertyid);
////            #endregion

////            #region HierarchicalDataSourceView 接口
////            //Select
////            CodeMemberMethod MethodSelect = new CodeMemberMethod();
////            MethodSelect.Name = "Select";
////            MethodSelect.Attributes = MemberAttributes.Public | MemberAttributes.Override;
////            MethodSelect.ReturnType = new CodeTypeReference(typeof(System.Web.UI.IHierarchicalEnumerable));
////            MethodSelect.Statements.Add(new CodeSnippetExpression(dbsAnalysisClass.Name + "HierarchicalEnumerable clhe = new " + dbsAnalysisClass.Name + "HierarchicalEnumerable()"));
////            MethodSelect.Statements.Add(new CodeSnippetStatement("foreach (" + dbsAnalysisClass.Name + " cg in _classname == \"\" ? " + dbsAnalysisClass.Name + ".getChild(_classid) : " + dbsAnalysisClass.Name + ".getChild(_classname)){"));
////            MethodSelect.Statements.Add(new CodeSnippetExpression("clhe.Add(new " + dbsAnalysisClass.Name + "HierarchyData(cg))"));
////            MethodSelect.Statements.Add(new CodeSnippetStatement("}"));
////            MethodSelect.Statements.Add(new CodeSnippetExpression("return clhe"));
////            ctd4.Members.Add(MethodSelect);
////            #endregion
////            Namespace.Types.Add(ctd4);
////            #endregion

////            #region  CatalogDataSource
////            #region 生成类
////            CodeTypeDeclaration ctd5 = new CodeTypeDeclaration(dbsAnalysisClass.Name + "DataSource");//生成类
////            ctd5.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" Copyright (C) " + System.DateTime.Today.Year + "  毛才君 版权所有。", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 文件编号：      ", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 文 件 名：      ", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 文件功能描述：  " + dbsAnalysisClass.Name + "的 DataSource 类", false));
////            ctd5.Comments.Add(new CodeCommentStatement("", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 创建标识：      毛才君    " + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "", false));
////            ctd5.Comments.Add(new CodeCommentStatement("", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd5.Comments.Add(new CodeCommentStatement("", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 修改标识：", false));
////            ctd5.Comments.Add(new CodeCommentStatement(" 修改描述：", false));
////            ctd5.Comments.Add(new CodeCommentStatement("----------------------------------------------------------------------------------------", false));

////            ctd5.IsClass = true;
////            ctd5.Attributes = MemberAttributes.Public;
////            ctd5.BaseTypes.Add(typeof(System.Web.UI.HierarchicalDataSourceControl));
////            ctd5.BaseTypes.Add(typeof(System.Web.UI.IHierarchicalDataSource));
////            ctd5.CustomAttributes.Add(new CodeAttributeDeclaration("System.Web.AspNetHostingPermission", new CodeAttributeArgument(new CodeSnippetExpression("System.Security.Permissions.SecurityAction.Demand,Level = System.Web.AspNetHostingPermissionLevel.Minimal"))));// "System.Security.Permissions.SecurityAction.Demand", "Level = System.Web.AspNetHostingPermissionLevel.Minimal"));
////            //生成类注释
////            ctd5.Comments.Add(new CodeCommentStatement("<summary>", true));
////            ctd5.Comments.Add(new CodeCommentStatement(dbsAnalysisClass.Name + "的 DataSource 类", true));
////            ctd5.Comments.Add(new CodeCommentStatement("</summary>", true));


////            //ctd5.Members.Add(new CodeMemberField(dbsAnalysisClass.Name+Config.DB_CLASS, "obj=null"));

////            #endregion
////            #region 构造函数
////            //参数构造函数
////            CodeConstructor constructor3 = new CodeConstructor();
////            constructor3.Attributes = MemberAttributes.Public;
////            constructor3.Comments.Add(new CodeCommentStatement("<summary>", true));
////            constructor3.Comments.Add(new CodeCommentStatement("类" + dbsAnalysisClass.Name + "DataSource 的构造函数", true));
////            constructor3.Comments.Add(new CodeCommentStatement("</summary>", true));
////            constructor3.Name = dbsAnalysisClass.Name + "DataSource";
////            ctd5.Members.Add(constructor3);
            
////            #endregion 构造函数
////            #region 生成类字段

////            //生成类的 私有字段
////            //view
////            CodeMemberField Fieldview = new CodeMemberField();
////            Fieldview.Attributes = MemberAttributes.Private;
////            Fieldview.Type = new CodeTypeReference(dbsAnalysisClass.Name+ "DataSourceView");
////            Fieldview.Name = "view=null";
////            ctd5.Members.Add(Fieldview);
////            //_classname
////            //CodeMemberField Field_classname = new CodeMemberField();
////            //Field_classname.Attributes = MemberAttributes.Private;
////            //Field_classname.Type = new CodeTypeReference(typeof(string));
////            //Field_classname.Name = "_classname=\"\"";
////            ctd5.Members.Add(Field_classname);
////            //_classid
////            //CodeMemberField Field_classid = new CodeMemberField();
////            //Field_classid.Attributes = MemberAttributes.Private;
////            //Field_classid.Type = new CodeTypeReference(typeof(Int32));
////            //Field_classid.Name = "_classid=0";
////            ctd5.Members.Add(Field_classid);
////            #endregion

////            #region 方法
////            //select1
////            CodeMemberMethod MethodSelect1 = new CodeMemberMethod();
////            MethodSelect1.Name = "Select";
////            MethodSelect1.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodSelect1.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name + "DataSource");
////            MethodSelect1.Statements.Add(new CodeSnippetExpression("return new " + dbsAnalysisClass.Name + "DataSource()"));
////            ctd5.Members.Add(MethodSelect1);
////            //select2
////            CodeMemberMethod MethodSelect2 = new CodeMemberMethod();
////            MethodSelect2.Name = "Select";
////            MethodSelect2.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodSelect2.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name + "DataSource");
////            MethodSelect2.Parameters.Add(new CodeParameterDeclarationExpression(typeof(int),"id"));
////            MethodSelect2.Statements.Add(new CodeSnippetExpression(dbsAnalysisClass.Name + "DataSource cds = new " + dbsAnalysisClass .Name+ "DataSource()"));
////            MethodSelect2.Statements.Add(new CodeSnippetExpression("cds._classid = id"));
////            MethodSelect2.Statements.Add(new CodeSnippetExpression("return cds"));
////            ctd5.Members.Add(MethodSelect2);
////            //select3
////            CodeMemberMethod MethodSelect3 = new CodeMemberMethod();
////            MethodSelect3.Name = "Select";
////            MethodSelect3.Attributes = MemberAttributes.Public | MemberAttributes.Static;
////            MethodSelect3.ReturnType = new CodeTypeReference(dbsAnalysisClass.Name + "DataSource");
////            MethodSelect3.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "ClassName"));
////            MethodSelect3.Statements.Add(new CodeSnippetExpression(dbsAnalysisClass.Name + "DataSource cds = new " + dbsAnalysisClass.Name + "DataSource()"));
////            MethodSelect3.Statements.Add(new CodeSnippetExpression("cds._classname = ClassName"));
////            MethodSelect3.Statements.Add(new CodeSnippetExpression("return cds"));
////            ctd5.Members.Add(MethodSelect3);
////            //CreateControlCollection
////            CodeMemberMethod MethodCreateControlCollection = new CodeMemberMethod();
////            MethodCreateControlCollection.Name = "CreateControlCollection";
////            MethodCreateControlCollection.Attributes = MemberAttributes.Family | MemberAttributes.Override;
////            MethodCreateControlCollection.ReturnType = new CodeTypeReference(typeof(System.Web.UI.ControlCollection));
////            MethodCreateControlCollection.Statements.Add(new CodeSnippetExpression("return new System.Web.UI.ControlCollection(this)"));
////            ctd5.Members.Add(MethodCreateControlCollection);
////            //GetHierarchicalView
////            CodeMemberMethod MethodGetHierarchicalView = new CodeMemberMethod();
////            MethodGetHierarchicalView.Name = "GetHierarchicalView";
////            MethodGetHierarchicalView.Attributes = MemberAttributes.Family | MemberAttributes.Override;
////            MethodGetHierarchicalView.ReturnType = new CodeTypeReference(typeof(System.Web.UI.HierarchicalDataSourceView));
////            MethodGetHierarchicalView.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "viewPath"));
////            MethodGetHierarchicalView.Statements.Add(new CodeSnippetStatement("if (null == view){"));
////            MethodGetHierarchicalView.Statements.Add(new CodeSnippetExpression("view = new " + dbsAnalysisClass.Name + "DataSourceView(viewPath)"));
////            MethodGetHierarchicalView.Statements.Add(new CodeSnippetExpression("view.id = this._classid"));
////            MethodGetHierarchicalView.Statements.Add(new CodeSnippetExpression("view.ClassName = _classname"));
////            MethodGetHierarchicalView.Statements.Add(new CodeSnippetStatement("}"));
////            MethodGetHierarchicalView.Statements.Add(new CodeSnippetExpression("return view"));
////            ctd5.Members.Add(MethodGetHierarchicalView);
//            #endregion
////            Namespace.Types.Add(ctd5);
//            #endregion

        }
    }
}
